package com.hjj.controller;

import com.hjj.beans.Stu;
import com.hjj.services.ClassRoomServices;
import com.hjj.services.StuServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/")
public class IndexController {
    @Autowired
    StuServices stuServices;

    @Autowired
    ClassRoomServices classRoomServices;


    @RequestMapping("index.action")
    public String index(){
        stuServices.doing();
        return "aaaaaaa";
    }

    @RequestMapping("add.action")
    public Stu add(){
        return stuServices.add();
    }

    @RequestMapping("edit.action")
    public String edti(){
        try {
            stuServices.edit();
        } catch (Exception e) {
            System.out.println("controller:" + e.getMessage());
        }
        return "edti";
    }

    @RequestMapping("del.action")
    public int del(int a, int b){
        return stuServices.del(a, b);
    }


    @RequestMapping("xxx.action")
    public void xxx(){
        stuServices.fun2();
        stuServices.fun4();
        classRoomServices.fun3();
        classRoomServices.fun5();
    }

}
